package 力扣;

public class Leedcode1137第N个泰波那契数 {
    public int tribonacci(int n) {
        int fir = 0;
        int sec = 1;
        int thr = 1;
        int ret = 0;
        if(n == 0){
            return 0;
        }
        if(n < 3){
            return 1;
        }
        for(int i = 3;i <= n;i++){
            ret = fir + sec + thr;
            int tem = sec;
            sec = thr;
            fir = tem;
            thr = ret;
        }
        return thr;
    }
}
